package cn.flkj.evidence;

import cn.flkj.evidence.RocketMQConsumer.RocketMQToFL;
import cn.flkj.evidence.repositories.EvidenceMapper;
import cn.flkj.evidence.RocketMQConsumer.RocketMQToEvidence;
import lombok.extern.log4j.Log4j2;

import org.springframework.boot.CommandLineRunner;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;

@Component
@Log4j2
public class Runner implements CommandLineRunner {

    private EvidenceImpl impl;
    @Resource
    private EvidenceMapper evidenceMapper;

    public Runner(EvidenceImpl impl) {
        this.impl = impl;
    }

    @Override
    public void run(String... args) throws Exception {

        //System.out.println("-------------------------- WEB3J INIT OK !!! --------------------------");

//        impl.experience();
//        System.out.println("=================="+evidenceMapper.hashCode());
//        RocketMQToEvidence rocketmqToEvidence = new RocketMQToEvidence(evidenceMapper,impl);
//        rocketmqToEvidence.send();

//        int max_id = evidenceMapper.evidenceIdMax();
//        System.out.println(max_id);

        /**
         *  RocketMQToES
         **/
        RocketMQToFL rocketMQToFL = new RocketMQToFL(impl,evidenceMapper);
        new Thread(()->rocketMQToFL.init()).start();


    }





}
